package com.spring.security.controller.mine;

import com.spring.security.common.entity.JsonResult;
import com.spring.security.common.utils.ResultTool;
import com.spring.security.entity.SysUser;
import com.spring.security.entity.mine.AttentionDataDTO;
import com.spring.security.entity.mine.MyAttentionQryInputDTO;
import com.spring.security.service.SysUserService;
import com.spring.security.service.mine.AttentionDataService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Author: zhoucq
 * @Description:
 * @Date Create in 2021/06/19 19:34
 */
@RestController
@RequestMapping("/mine")
public class AttentionController {
    @Autowired
    AttentionDataService attentionDataService;

    @ApiOperation("新增我的关注")
    @ApiImplicitParam(name = "attentionDataDTO",value = "新增我的关注入参",dataType = "AttentionDataDTO")
    @RequestMapping(value = "/addAttention",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public JsonResult addAttention(@RequestBody AttentionDataDTO attentionDataDTO) {
        return ResultTool.success(attentionDataService.addAttention(attentionDataDTO));
    }

    @ApiOperation("通过主键（id）查询我的关注")
    @ApiImplicitParam(name = "attentionDataDTO",value = "通过主键（id）查询我的关注",dataType = "AttentionDataDTO")
    @RequestMapping(value = "/queryById",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public JsonResult queryById(@RequestBody AttentionDataDTO attentionDataDTO) {
        return ResultTool.success(attentionDataService.queryById(attentionDataDTO.getId()));
    }

    @ApiOperation("查询我的关注列表")
    @ApiImplicitParam(name = "myAttentionQryInputDTO",value = "查询我的关注列表",dataType = "MyAttentionQryInputDTO")
    @RequestMapping(value = "/queryMyAttentionList",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public JsonResult queryMyAttentionList(@RequestBody MyAttentionQryInputDTO myAttentionQryInputDTO) {
        return ResultTool.success(attentionDataService.queryMyAttentionList(myAttentionQryInputDTO));
    }

    @ApiOperation("更新我的关注")
    @ApiImplicitParam(name = "attentionDataDTO",value = "更新我的关注",dataType = "AttentionDataDTO")
    @RequestMapping(value = "/updateMyAttentionById",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public JsonResult updateMyAttentionById(@RequestBody AttentionDataDTO attentionDataDTO) {
        return ResultTool.success(attentionDataService.updateMyAttentionById(attentionDataDTO));
    }

    @ApiOperation("删除我的关注")
    @ApiImplicitParam(name = "attentionDataDTO",value = "删除我的关注",dataType = "AttentionDataDTO")
    @RequestMapping(value = "/deleteMyAttentionById",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public JsonResult deleteMyAttentionById(@RequestBody AttentionDataDTO attentionDataDTO) {
        return ResultTool.success(attentionDataService.deleteMyAttentionById(attentionDataDTO));
    }

    @ApiOperation("查询关注我的列表")
    @ApiImplicitParam(name = "myAttentionQryInputDTO",value = "查询我的关注列表",dataType = "MyAttentionQryInputDTO")
    @RequestMapping(value = "/queryAttentionMeList",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public JsonResult queryAttentionMeList(@RequestBody MyAttentionQryInputDTO myAttentionQryInputDTO) {
        return ResultTool.success(attentionDataService.queryAttentionMeList(myAttentionQryInputDTO));
    }

}
